package gof23.structure.adapter;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;

public class JDKAdaperDemo {

	public static void main(String[] args) throws IOException {
		
		byte[] bytes = {97,98,99,100,101};
		char[] chs =new char[bytes.length];
		
		InputStream inputStream = new ByteArrayInputStream(bytes);
		
		/**
		 * InputStreamReader 通过引用方式适配了InputStream到Reader
		 */
		Reader reader = new InputStreamReader(inputStream);
		reader.read(chs);
		
		System.out.println(new String(chs));
		
	}
}
